<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>个人中心 - 小笑舒压</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            color: #333;
        }

        .container {
            max-width: 414px;
            margin: 0 auto;
            background: #fff;
            min-height: 100vh;
            position: relative;
        }

        /* 顶部导航 */
        .top-nav {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 15px 20px;
            display: flex;
            align-items: center;
            position: sticky;
            top: 0;
            z-index: 100;
        }

        .back-btn {
            background: none;
            border: none;
            color: white;
            font-size: 18px;
            cursor: pointer;
            margin-right: 15px;
        }

        .page-title {
            font-size: 18px;
            font-weight: 600;
        }

        /* 用户信息区域 */
        .user-profile {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 30px 20px;
            text-align: center;
        }

        .avatar {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.2);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 36px;
            margin: 0 auto 15px;
            border: 3px solid rgba(255, 255, 255, 0.3);
        }

        .user-name {
            font-size: 20px;
            font-weight: 600;
            margin-bottom: 8px;
        }

        .user-status {
            font-size: 14px;
            opacity: 0.9;
            margin-bottom: 20px;
        }

        .stress-indicator {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            background: rgba(255, 255, 255, 0.1);
            padding: 10px 20px;
            border-radius: 20px;
            margin: 0 auto;
            max-width: 200px;
        }

        .stress-icon {
            font-size: 18px;
        }

        .stress-text {
            font-size: 14px;
        }

        /* 心情统计区域 */
        .mood-stats {
            background: #f8f9fa;
            margin: 20px;
            border-radius: 16px;
            padding: 20px;
        }

        .section-title {
            font-size: 18px;
            font-weight: 600;
            margin-bottom: 15px;
            color: #333;
            display: flex;
            align-items: center;
        }

        .section-title i {
            margin-right: 8px;
            color: #667eea;
        }

        .stats-overview {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr;
            gap: 15px;
            margin-bottom: 20px;
        }

        .stats-item {
            text-align: center;
            padding: 15px;
            background: white;
            border-radius: 12px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
            transition: all 0.3s ease;
            cursor: pointer;
            position: relative;
            overflow: hidden;
        }

        .stats-item:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        }

        .stats-item::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 3px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            transform: scaleX(0);
            transition: transform 0.3s ease;
        }

        .stats-item:hover::before {
            transform: scaleX(1);
        }

        .stats-number {
            font-size: 24px;
            font-weight: 700;
            color: #667eea;
            margin-bottom: 5px;
            transition: color 0.3s ease;
        }

        .stats-item:hover .stats-number {
            color: #764ba2;
        }

        .stats-label {
            font-size: 12px;
            color: #666;
            transition: color 0.3s ease;
        }

        .stats-item:hover .stats-label {
            color: #333;
        }

        .weekly-mood-display {
            background: white;
            border-radius: 12px;
            padding: 20px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        }

        .mood-days {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 20px;
        }

        .mood-day {
            flex: 1;
            text-align: center;
            padding: 10px 5px;
        }

        .mood-emoji {
            font-size: 32px;
            margin-bottom: 8px;
            display: block;
            transition: transform 0.3s ease;
        }

        .mood-emoji:hover {
            transform: scale(1.2);
        }

        .mood-emoji.no-record {
            font-size: 24px;
            color: #ccc;
        }

        .day-label {
            font-size: 12px;
            color: #666;
            margin-bottom: 5px;
        }

        .date-label {
            font-size: 10px;
            color: #999;
        }

        /* 设置区域 */
        .settings-section {
            margin: 20px;
        }

        .setting-group {
            background: white;
            border-radius: 16px;
            margin-bottom: 20px;
            overflow: hidden;
            box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
        }

        .setting-group-title {
            background: #f8f9fa;
            padding: 15px 20px;
            font-size: 16px;
            font-weight: 600;
            color: #333;
            border-bottom: 1px solid #eee;
        }

        .setting-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 18px 20px;
            border-bottom: 1px solid #f0f0f0;
            cursor: pointer;
            transition: background-color 0.3s ease;
        }

        .setting-item:last-child {
            border-bottom: none;
        }

        .setting-item:hover {
            background-color: #f8f9fa;
        }

        .setting-left {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .setting-icon {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 18px;
        }

        .setting-info {
            flex: 1;
        }

        .setting-title {
            font-size: 16px;
            color: #333;
            margin-bottom: 3px;
        }

        .setting-desc {
            font-size: 13px;
            color: #666;
        }

        .setting-right {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .toggle-switch {
            position: relative;
            width: 50px;
            height: 28px;
            background: #ccc;
            border-radius: 14px;
            cursor: pointer;
            transition: background-color 0.3s ease;
        }

        .toggle-switch.active {
            background: #667eea;
        }

        .toggle-switch::after {
            content: '';
            position: absolute;
            top: 2px;
            left: 2px;
            width: 24px;
            height: 24px;
            background: white;
            border-radius: 50%;
            transition: transform 0.3s ease;
        }

        .toggle-switch.active::after {
            transform: translateX(22px);
        }

        .arrow-icon {
            color: #ccc;
            font-size: 16px;
        }

        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 100%;
            max-width: 414px;
            background: white;
            border-top: 1px solid #eee;
            display: flex;
            padding: 10px 0;
            box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        }

        .nav-item {
            flex: 1;
            text-align: center;
            padding: 8px 0;
            cursor: pointer;
            transition: color 0.3s ease;
            color: #999;
        }

        .nav-item.active {
            color: #667eea;
        }

        .nav-item i {
            font-size: 20px;
            margin-bottom: 4px;
            display: block;
        }

        .nav-item span {
            font-size: 12px;
        }

        /* 响应式设计 */
        @media (max-width: 375px) {
            .user-profile {
                padding: 25px 15px;
            }

            .avatar {
                width: 70px;
                height: 70px;
                font-size: 32px;
            }

            .mood-stats,
            .settings-section {
                margin: 15px;
            }
        }
    </style>
</head>

<body>
    <div class="container">
        <!-- 顶部导航 -->
        <div class="top-nav">
            <button class="back-btn" onclick="goBack()">
                <i class="fas fa-arrow-left"></i>
            </button>
            <div class="page-title">个人中心</div>
        </div>

        <!-- 用户信息区域 -->
        <div class="user-profile">
            <div class="avatar">
                <i class="fas fa-user"></i>
            </div>
            <div class="user-name">小笑用户</div>
            <div class="user-status">今天也要开开心心的哦！</div>
            <div class="stress-indicator">
                <div class="stress-icon">😊</div>
                <div class="stress-text">压力指数：轻度</div>
            </div>
        </div>

        <!-- 心情统计区域 -->
        <div class="mood-stats">
            <h3 class="section-title">
                <i class="fas fa-chart-line"></i>
                最近一周心情统计
            </h3>

            <div class="stats-overview">
                <div class="stats-item" title="最近一周记录心情的天数" onclick="showDetailedStats('count')">
                    <div class="stats-number" id="weeklyMoodCount">0</div>
                    <div class="stats-label">记录天数</div>
                </div>
                <div class="stats-item" title="最近一周心情分数的平均值" onclick="showDetailedStats('average')">
                    <div class="stats-number" id="avgMoodScore">0</div>
                    <div class="stats-label">平均心情</div>
                </div>
                <div class="stats-item" title="最近一周最高心情分数" onclick="showDetailedStats('best')">
                    <div class="stats-number" id="bestMoodDay">0</div>
                    <div class="stats-label">最佳心情</div>
                </div>
            </div>

            <div class="weekly-mood-display" id="weeklyMoodDisplay">
                <!-- 周心情表情将通过JavaScript动态生成 -->
            </div>
        </div>

        <!-- 设置区域 -->
        <div class="settings-section">
            <!-- 应用游戏设置 -->
            <div class="setting-group">
                <div class="setting-group-title">应用游戏设置</div>

                <div class="setting-item">
                    <div class="setting-left">
                        <div class="setting-icon">
                            <i class="fas fa-music"></i>
                        </div>
                        <div class="setting-info">
                            <div class="setting-title">背景音乐</div>
                            <div class="setting-desc">开启应用背景音乐</div>
                        </div>
                    </div>
                    <div class="setting-right">
                        <div class="toggle-switch" id="bgMusicToggle" onclick="toggleSetting('bgMusic')"></div>
                    </div>
                </div>

                <div class="setting-item">
                    <div class="setting-left">
                        <div class="setting-icon">
                            <i class="fas fa-vibrate"></i>
                        </div>
                        <div class="setting-info">
                            <div class="setting-title">震动反馈</div>
                            <div class="setting-desc">开启操作震动反馈</div>
                        </div>
                    </div>
                    <div class="setting-right">
                        <div class="toggle-switch" id="vibrationToggle" onclick="toggleSetting('vibration')"></div>
                    </div>
                </div>
            </div>

            <!-- 显示设置 -->
            <div class="setting-group">
                <div class="setting-group-title">显示设置</div>

                <div class="setting-item">
                    <div class="setting-left">
                        <div class="setting-icon">
                            <i class="fas fa-moon"></i>
                        </div>
                        <div class="setting-info">
                            <div class="setting-title">深色模式</div>
                            <div class="setting-desc">切换深色主题</div>
                        </div>
                    </div>
                    <div class="setting-right">
                        <div class="toggle-switch" id="darkModeToggle" onclick="toggleSetting('darkMode')"></div>
                    </div>
                </div>

                <div class="setting-item">
                    <div class="setting-left">
                        <div class="setting-icon">
                            <i class="fas fa-palette"></i>
                        </div>
                        <div class="setting-info">
                            <div class="setting-title">主题颜色</div>
                            <div class="setting-desc">切换应用主题色</div>
                        </div>
                    </div>
                    <div class="setting-right">
                        <i class="fas fa-chevron-right arrow-icon"></i>
                    </div>
                </div>
            </div>

            <!-- 其他设置 -->
            <div class="setting-group">
                <div class="setting-group-title">其他设置</div>

                <div class="setting-item" onclick="showHelp()">
                    <div class="setting-left">
                        <div class="setting-icon">
                            <i class="fas fa-question-circle"></i>
                        </div>
                        <div class="setting-info">
                            <div class="setting-title">帮助反馈</div>
                            <div class="setting-desc">获取帮助和提交反馈</div>
                        </div>
                    </div>
                    <div class="setting-right">
                        <i class="fas fa-chevron-right arrow-icon"></i>
                    </div>
                </div>

                <div class="setting-item" onclick="contactUs()">
                    <div class="setting-left">
                        <div class="setting-icon">
                            <i class="fas fa-envelope"></i>
                        </div>
                        <div class="setting-info">
                            <div class="setting-title">联系我们</div>
                            <div class="setting-desc">联系客服团队</div>
                        </div>
                    </div>
                    <div class="setting-right">
                        <i class="fas fa-chevron-right arrow-icon"></i>
                    </div>
                </div>

                <div class="setting-item" onclick="showPrivacy()">
                    <div class="setting-left">
                        <div class="setting-icon">
                            <i class="fas fa-shield-alt"></i>
                        </div>
                        <div class="setting-info">
                            <div class="setting-title">隐私政策</div>
                            <div class="setting-desc">查看隐私保护政策</div>
                        </div>
                    </div>
                    <div class="setting-right">
                        <i class="fas fa-chevron-right arrow-icon"></i>
                    </div>
                </div>

                <div class="setting-item" onclick="showTerms()">
                    <div class="setting-left">
                        <div class="setting-icon">
                            <i class="fas fa-file-contract"></i>
                        </div>
                        <div class="setting-info">
                            <div class="setting-title">用户协议</div>
                            <div class="setting-desc">查看用户使用协议</div>
                        </div>
                    </div>
                    <div class="setting-right">
                        <i class="fas fa-chevron-right arrow-icon"></i>
                    </div>
                </div>

                <div class="setting-item" onclick="clearData()">
                    <div class="setting-left">
                        <div class="setting-icon">
                            <i class="fas fa-trash-alt"></i>
                        </div>
                        <div class="setting-info">
                            <div class="setting-title">清除数据</div>
                            <div class="setting-desc">清除所有本地数据</div>
                        </div>
                    </div>
                    <div class="setting-right">
                        <i class="fas fa-chevron-right arrow-icon"></i>
                    </div>
                </div>
            </div>
        </div>

        <!-- 底部导航 -->
        <nav class="bottom-nav">
            <div class="nav-item" onclick="switchTab('test')">
                <i class="fas fa-clipboard-check"></i>
                <span>测试</span>
            </div>
            <div class="nav-item" onclick="switchTab('consult')">
                <i class="fas fa-comments"></i>
                <span>咨询</span>
            </div>
            <div class="nav-item" onclick="switchTab('relax')">
                <i class="fas fa-gamepad"></i>
                <span>放松</span>
            </div>
            <div class="nav-item active" onclick="switchTab('profile')">
                <i class="fas fa-user"></i>
                <span>我的</span>
            </div>
        </nav>
    </div>

    <script>
        // 心情数据存储
        let moodData = JSON.parse(localStorage.getItem('moodData')) || [];

        // 设置数据存储
        let settings = JSON.parse(localStorage.getItem('appSettings')) || {
            bgMusic: false,
            vibration: true,
            darkMode: false
        };

        // 页面加载完成后的初始化
        document.addEventListener('DOMContentLoaded', function () {
            // 初始化心情统计
            updateMoodStats();
            renderWeeklyMoodDisplay();

            // 初始化设置状态
            updateSettingsDisplay();
        });

        // 切换底部导航
        function switchTab(tabName) {
            // 移除所有active类
            document.querySelectorAll('.nav-item').forEach(item => {
                item.classList.remove('active');
            });

            // 为当前点击的tab添加active类
            event.currentTarget.classList.add('active');

            // 页面切换逻辑
            switch (tabName) {
                case 'test':
                    window.location.href = 'test.html';
                    break;
                case 'consult':
                    window.location.href = 'consult.html';
                    break;
                case 'relax':
                    // 跳转到放松tab（暂时不处理）
                    console.log('放松功能开发中...');
                    break;
                case 'profile':
                    // 已经在个人中心页面
                    break;
            }
        }

        // 更新心情统计
        function updateMoodStats() {
            const today = new Date().toISOString().split('T')[0];
            const weekAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString().split('T')[0];

            // 获取最近一周的心情数据
            const weeklyMoods = moodData.filter(item => item.date >= weekAgo);

            // 计算统计信息
            const weeklyMoodCount = weeklyMoods.length;
            const avgMoodScore = weeklyMoodCount > 0 ?
                Math.round(weeklyMoods.reduce((sum, item) => sum + item.score, 0) / weeklyMoodCount * 10) / 10 : 0;
            
            // 获取最佳心情日期和分数
            let bestMoodInfo = { score: 0, date: '', text: '' };
            if (weeklyMoods.length > 0) {
                const bestMood = weeklyMoods.reduce((best, current) => 
                    current.score > best.score ? current : best
                );
                bestMoodInfo = {
                    score: bestMood.score,
                    date: formatDate(bestMood.date),
                    text: bestMood.text
                };
            }

            // 更新显示
            document.getElementById('weeklyMoodCount').textContent = weeklyMoodCount;
            document.getElementById('avgMoodScore').textContent = formatMoodScore(avgMoodScore);
            document.getElementById('bestMoodDay').textContent = formatBestMood(bestMoodInfo);
        }

        // 格式化心情分数显示
        function formatMoodScore(score) {
            if (score === 0) return '暂无';
            
            let emoji = getMoodEmoji(score);
            let level = '';
            
            if (score >= 4.5) level = '优秀';
            else if (score >= 4.0) level = '良好';
            else if (score >= 3.5) level = '不错';
            else if (score >= 3.0) level = '一般';
            else if (score >= 2.5) level = '偏低';
            else if (score >= 2.0) level = '较差';
            else level = '很差';
            
            return `${emoji} ${score}分`;
        }

        // 格式化最佳心情显示
        function formatBestMood(bestMoodInfo) {
            if (bestMoodInfo.score === 0) return '暂无';
            
            let emoji = getMoodEmoji(bestMoodInfo.score);
            return `${emoji} ${bestMoodInfo.score}分`;
        }

        // 显示详细统计信息
        function showDetailedStats(type) {
            const today = new Date().toISOString().split('T')[0];
            const weekAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString().split('T')[0];
            const weeklyMoods = moodData.filter(item => item.date >= weekAgo);
            
            let message = '';
            
            switch(type) {
                case 'count':
                    if (weeklyMoods.length === 0) {
                        message = '本周还没有记录心情哦！\n建议每天记录一下，了解自己的心情变化。';
                    } else {
                        const recordedDays = weeklyMoods.map(item => formatDate(item.date)).join('、');
                        message = `本周已记录 ${weeklyMoods.length} 天的心情：\n${recordedDays}\n\n继续加油，记录每一天的心情！`;
                    }
                    break;
                    
                case 'average':
                    if (weeklyMoods.length === 0) {
                        message = '暂无数据，无法计算平均心情。\n开始记录心情后，这里会显示您的平均心情分数。';
                    } else {
                        const avgScore = (weeklyMoods.reduce((sum, item) => sum + item.score, 0) / weeklyMoods.length).toFixed(1);
                        const level = getMoodLevel(avgScore);
                        message = `本周平均心情：${avgScore}分\n心情等级：${level}\n\n${getMoodAdvice(avgScore)}`;
                    }
                    break;
                    
                case 'best':
                    if (weeklyMoods.length === 0) {
                        message = '暂无数据，无法显示最佳心情。\n记录心情后，这里会显示您本周的最高心情分数。';
                    } else {
                        const bestMood = weeklyMoods.reduce((best, current) => 
                            current.score > best.score ? current : best
                        );
                        const emoji = getMoodEmoji(bestMood.score);
                        message = `本周最佳心情：${emoji}\n分数：${bestMood.score}分\n日期：${formatDate(bestMood.date)}\n描述：${bestMood.text}\n\n继续保持好心情！`;
                    }
                    break;
            }
            
            alert(message);
        }

        // 获取心情等级
        function getMoodLevel(score) {
            if (score >= 4.5) return '优秀 😄';
            if (score >= 4.0) return '良好 😊';
            if (score >= 3.5) return '不错 🙂';
            if (score >= 3.0) return '一般 😐';
            if (score >= 2.5) return '偏低 😕';
            if (score >= 2.0) return '较差 😟';
            return '很差 😢';
        }

        // 获取心情建议
        function getMoodAdvice(score) {
            if (score >= 4.0) return '您的心情很棒！继续保持积极乐观的心态。';
            if (score >= 3.0) return '您的心情还不错，可以尝试一些放松活动来提升心情。';
            if (score >= 2.0) return '您的心情有些低落，建议多与朋友交流，或者尝试一些减压活动。';
            return '您的心情比较差，建议寻求专业帮助或与信任的人倾诉。';
        }

        // 渲染周心情图表
        function renderWeeklyMoodDisplay() {
            const displayContainer = document.getElementById('weeklyMoodDisplay');
            const weekDays = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'];

            // 获取最近一周的日期
            const today = new Date();
            const weekDates = [];
            for (let i = 6; i >= 0; i--) {
                const date = new Date(today);
                date.setDate(today.getDate() - i);
                weekDates.push(date.toISOString().split('T')[0]);
            }

            // 生成显示HTML
            let displayHTML = '<div class="mood-days">';
            weekDates.forEach((date, index) => {
                const mood = moodData.find(item => item.date === date);
                let emoji, title;
                
                if (mood) {
                    // 根据心情分数选择对应的表情
                    emoji = getMoodEmoji(mood.score);
                    title = `${mood.text} (${mood.score}分)`;
                } else {
                    emoji = '😐';
                    title = '无记录';
                }
                
                const dayLabel = weekDays[index];
                const dateLabel = formatDate(date);

                displayHTML += `
                    <div class="mood-day">
                        <div class="mood-emoji ${mood ? '' : 'no-record'}" title="${title}">${emoji}</div>
                        <div class="day-label">${dayLabel}</div>
                        <div class="date-label">${dateLabel}</div>
                    </div>
                `;
            });
            displayHTML += '</div>';

            displayContainer.innerHTML = displayHTML;
        }

        // 根据心情分数获取对应的表情
        function getMoodEmoji(score) {
            if (score >= 4.5) return '😄'; // 非常开心
            if (score >= 4.0) return '😊'; // 开心
            if (score >= 3.5) return '🙂'; // 还不错
            if (score >= 3.0) return '😐'; // 一般
            if (score >= 2.5) return '😕'; // 有点不开心
            if (score >= 2.0) return '😟'; // 不开心
            if (score >= 1.5) return '😞'; // 比较难过
            if (score >= 1.0) return '😢'; // 难过
            return '😭'; // 非常难过
        }

        // 格式化日期显示
        function formatDate(dateString) {
            const date = new Date(dateString);
            const month = date.getMonth() + 1;
            const day = date.getDate();
            return `${month}/${day}`;
        }

        // 切换设置
        function toggleSetting(settingName) {
            settings[settingName] = !settings[settingName];
            localStorage.setItem('appSettings', JSON.stringify(settings));
            updateSettingsDisplay();

            // 根据设置执行相应操作
            switch (settingName) {
                case 'bgMusic':
                    if (settings.bgMusic) {
                        console.log('背景音乐已开启');
                    } else {
                        console.log('背景音乐已关闭');
                    }
                    break;
                case 'vibration':
                    if (settings.vibration) {
                        console.log('震动反馈已开启');
                    } else {
                        console.log('震动反馈已关闭');
                    }
                    break;
                case 'darkMode':
                    if (settings.darkMode) {
                        console.log('深色模式已开启');
                        document.body.classList.add('dark-mode');
                    } else {
                        console.log('深色模式已关闭');
                        document.body.classList.remove('dark-mode');
                    }
                    break;
            }
        }

        // 更新设置显示状态
        function updateSettingsDisplay() {
            document.getElementById('bgMusicToggle').classList.toggle('active', settings.bgMusic);
            document.getElementById('vibrationToggle').classList.toggle('active', settings.vibration);
            document.getElementById('darkModeToggle').classList.toggle('active', settings.darkMode);
        }

        // 显示帮助
        function showHelp() {
            alert('帮助反馈功能开发中...\n如有问题请联系客服。');
        }

        // 联系我们
        function contactUs() {
            alert('联系我们\n客服邮箱：support@xiaoxiao.com\n客服电话：400-123-4567');
        }

        // 显示隐私政策
        function showPrivacy() {
            alert('隐私政策\n我们承诺保护您的个人隐私，不会泄露您的个人信息。\n详细政策请访问官网查看。');
        }

        // 显示用户协议
        function showTerms() {
            alert('用户协议\n使用本应用即表示您同意遵守相关条款和条件。\n详细协议请访问官网查看。');
        }

        // 清除数据
        function clearData() {
            if (confirm('确定要清除所有本地数据吗？此操作不可恢复！')) {
                localStorage.clear();
                moodData = [];
                settings = {
                    bgMusic: false,
                    vibration: true,
                    darkMode: false
                };
                alert('数据已清除！');
                location.reload();
            }
        }

        // 返回首页
        function goBack() {
            window.location.href = 'index.html';
        }
    </script>
</body>

</html>